package com.ooqiu.gaming.utils;

import android.text.TextUtils;

import java.util.List;

/**
 * @author Eenie
 * @date 2017/12/6
 */

public class ListToStrUtil<T> {
    public CharSequence toStr(List<T> srcData) {
        StringBuilder sb = new StringBuilder();
        for (T data : srcData) {
            sb.append(getFieldStr(data)+getDivisionFlag());
        }
        if (!TextUtils.isEmpty(sb.toString())) {
            return sb.subSequence(0, sb
                    .length() - 1);
        }
        return sb.toString();
    }




    public String getFieldStr(T data) {
        return data.toString();
    }
    public String getDivisionFlag() {
        return ",";
    }
}
